<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/base.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>登录</title>
    <link rel="stylesheet" href="${ctx}/static/libs/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="${ctx}/static/libs/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="${ctx}/static/css/common/base.css"/>
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" href="${ctx}/static/css/login.css">
</head>

<body>
    <header>
        <nav class="navbar navbar-default navbar-static-top">
            <div class="container-fluid">
                <div class="navbar-header">
                    <a class="navbar-brand" href="${ctx}/index">
                        <img src="${ctx}/static/images/common/logo.png">
                    </a>
                    <a class="navbar-brand reg-link" href="#">索明信息管理后台</a>
                </div>
            </div>
        </nav>
    </header>
    <div class="container">
        <div class="col-md-7">
            <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
                <!-- Indicators -->
                <ol class="carousel-indicators">
                    <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
                    <li data-target="#carousel-example-generic" data-slide-to="1"></li>
                    <li data-target="#carousel-example-generic" data-slide-to="2"></li>
                </ol>
                <!-- Wrapper for slides -->
                <div class="carousel-inner" role="listbox">
                    <div class="item active">
                        <img src="..." alt="...">
                        <div class="carousel-caption">
                            ...
                        </div>
                    </div>
                    <div class="item">
                        <img src="..." alt="...">
                        <div class="carousel-caption">
                            ...
                        </div>
                    </div>
                    ...
                </div>
                <!-- Controls -->
                <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
                    <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
                    <span class="sr-only">Previous</span>
                </a>
                <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
                    <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
                    <span class="sr-only">Next</span>
                </a>
                <button class="btn btn-warning">立即企业注册</button>
            </div>
        </div>
        <div class="col-md-4">
            <div class="container login-container">
                <form action="${ctx}/login" id="loginForm" method="post">
                	<c:if test="${not empty error}"><small class="help-block alert alert-danger">${error}</small></c:if>
                    <div class="form-group">
                        <input type="text" name="username" class="form-control" placeholder="管理员账号">
                    </div>
                    <div class="form-group">
                        <input type="password" name="password" class="form-control" placeholder="密码">
                    </div>
                   
                    <div class="form-group">
                        <a href="" class="pull-right">找回用户名/密码</a>
                    </div>
                    <div class="form-group">
                        <button id="loginBtn" class="btn btn-success">登录</button>
                    </div>
                    <div class="form-group">
                        <a href="" class="pull-right">企业注册</a>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <script src="${ctx}/static/libs/jquery/jquery.min.js"></script>
    <script src="${ctx}/static/libs/jquery/jquery.validate.min.js"></script>
    <script src="${ctx}/static/libs/bootstrap/js/bootstrap.min.js"></script>
    <script src="${ctx}/static/libs/jquery/messages_zh.min.js"></script>
    <script type="text/javascript">
    	var random = Math.floor(Math.random()*100);
	    $(function(){  //生成验证码         
	        $('#kaptchaImage').click(function () {  
	        $(this).hide().attr('src', '${ctx}/kaptcha/getKaptchaImage?random=' + random ).fadeIn(); });      
	    });
    	function changeCode() {  
       	 	$('#kaptchaImage').hide().attr('src', '${ctx}/kaptcha/getKaptchaImage?random=' + random ).fadeIn();
        	event.cancelBubble=true;  
    	}
    	 $(document).ready(function(){
    		 //alert("validate");
    		 $("#loginForm").validate({
    			 rules : {
    				 username : {
    					 required : true
    				 },
    				 password : {
    					 required : true
    				 }
    			 },
    			 messages : {
    				 username : {
    					 required : "用户名不能为空"
    				 },
    				 password : {
    					 required : "密码不能为空"
    				 }
    			 },
    			 errorElement : "span",
    			 submitHandler:function(form){
    		            form.submit();
    		     }
    		     
    		 });
    	 });
    </script>
</body>

</html>


